﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Customers;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Customers
{

    #region  Role
    public class RoleBUSS
    {
        //private const string ROLE_ALL_KEY = "Mp.role.all-{0}}";
        //private const string ROLE_BY_ID_KEY = "Mp.mp_role.id-{0}";
        //MpCache.RemoveByPattern(ROLE_ALL_KEY);
        //        MpCache.RemoveByPattern(ROLE_BY_ID_KEY);
        public static int Role_Add(Role obj)
        {
            var result = RoleDAO.Role_Add(obj);
            return result;
        }
        public static int Role_Update(Role obj)
        {
            var result = RoleDAO.Role_Update(obj);
            return result;
        }

        public static int Role_Delete(int RoleID)
        {
            var result = RoleDAO.Role_Delete(RoleID);
            return result;
        }

        public static Role Role_ByID(int RoleID)
        {
            if (RoleID > 0)
            {
                var list = Role_List(RoleID);
                if (list != null)
                    return list.FirstOrDefault();
            }
            return null;
        }

        public static List<Role> Role_List(int RoleID)
        {
            return RoleDAO.Role_List(RoleID);
        }
    }
    #endregion
}
